home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / source_code / dhtmlunl / dhtml.exe / CD Content / Chap17 / dun17_6.txt < prev    next >
Encoding:
Text File  |  1997-12-18  |  940 b   |  34 lines

  1. function submit_onKeyUp(event)
  2.  
  3. {
  4.  
  5.   document.forms.order.submitButton.focus();
  6.  
  7.   document.forms.order.submitButton.click();
  8.  
  9. }
  10.  
  11.  
  12.  
  13. function reset_onKeyUp(event)
  14.  
  15. {
  16.  
  17.   document.forms.order.resetButton.focus();
  18.  
  19.   document.forms.order.resetButton.click();
  20.  
  21. }
  22.  
  23.  
  24.  
  25. function window_onKeyUp(event)
  26.  
  27. {
  28.  
  29.   // The ENTER key is 13, which submits the form and
  30.  
  31.   // the ESC key is 27, which resets the form. Otherwise,
  32.  
  33.   // the event is routed to other event handlers.
  34.  
  35.   if (event.which == 13)
  36.  
  37.     document.forms.order.submitButton.handleEvent(event);
  38.  
  39.   else if (event.which == 27)
  40.  
  41.     document.forms.order.resetButton.handleEvent(event);
  42.  
  43.   else
  44.  
  45.     return routeEvent(event);
  46.  
  47. }
  48.  
  49.  
  50.  
  51. function initialize()
  52.  
  53. {
  54.  
  55.   document.forms.order.submitButton.onkeyup = submit_onKeyUp;
  56.  
  57.   document.forms.order.resetButton.onkeyup = reset_onKeyUp;
  58.  
  59.  
  60.  
  61.   window.captureEvents(Event.KEYUP);
  62.  
  63.   window.onkeyup = window_onKeyUp;
  64.  
  65. }
  66.  
  67.